<template>
  <div id="app">
    <div class="mask" v-if="show" @click="show = false">
      <h1>{{ info.name }}</h1>
      <van-rate
        v-model="info.score"
        :size="20"
        allow-half
        void-icon="star"
        void-color="#eee"
        color="#ffd21e"
      />
      <van-divider
        :style="{ color: '#fff', borderColor: '#fff', padding: '0 16px' }"
        >优惠信息</van-divider
      >
      <van-divider
        :style="{ color: '#fff', borderColor: '#fff', padding: '0 16px' }"
        >商家公告</van-divider
      >
      <p class="bulletin">
        {{ info.bulletin }}
      </p>
    </div>

    <div class="header flex" @click="show = true">
      <div>
        <img :src="info.avatar" alt="" />
      </div>
      <div class="content">
        <p>{{ info.name }}</p>
        <p>{{ info.description }}/{{ info.deliveryTime }}分钟送达</p>
        <p class="bulletin">公告:{{ info.bulletin }}</p>
      </div>
    </div>

    <div class="container">
      <div class="nav">
        <router-link to="/">商品</router-link>
        <router-link to="/evaluate">评价</router-link>
        <router-link to="/marchart">商品</router-link>
      </div>
      <router-view></router-view>
    </div>
  </div>
</template>

<script>
import { store } from "./apis/order";
export default {
  data() {
    return {
      info: {},
      show: false,
    };
  },
  created() {
    store().then((res) => {
      this.info = res.data.data;
      console.log(this.info);
    });
  },
};
</script>

<style lang="less" scoped>
#app {
  height: 100%;
}
.header {
  height: 80px;
  background-color: #000;
  padding: 40px 10px 10px 20px;
  img {
    width: 80px;
    height: 80px;
    padding-right: 10px;
  }
  .content {
    color: #fff;
    .bulletin {
      padding-top: 10px;
      width: 240px;
      font-size: 12px;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    }
  }
}
.nav {
  display: flex;
  justify-content: space-around;
  padding: 10px 0;
}
.container {
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.mask {
  position: fixed;
  height: 100%;
  width: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  z-index: 1;
  color: #fff;
  h1 {
    font-size: 24px;
    text-align: center;
    padding-top: 40px;
  }
  .bulletin {
    padding: 0 16px;
  }
}
</style>
